package cn.adelyn.blog.search.feign;

import cn.adelyn.blog.api.search.feign.BlogSearchFeignClient;
import cn.adelyn.blog.api.search.pojo.bo.DeleteBlogBO;
import cn.adelyn.blog.api.search.pojo.bo.InsertBlogBO;
import cn.adelyn.blog.search.service.BlogSearchService;
import cn.adelyn.common.core.response.ServerResponseEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class BlogSearchFeignController implements BlogSearchFeignClient {

    @Autowired
    BlogSearchService blogSearchService;

    @Override
    public ServerResponseEntity insertBlog(InsertBlogBO insertBlogBO) {
        blogSearchService.insertBlog(insertBlogBO);
        return ServerResponseEntity.success();
    }

    @Override
    public ServerResponseEntity updateBlog(InsertBlogBO insertBlogBO) {
        blogSearchService.updateBlog(insertBlogBO);
        return ServerResponseEntity.success();
    }

    @Override
    public ServerResponseEntity deleteBlog(DeleteBlogBO deleteBlogBO) {
        blogSearchService.deleteBlog(deleteBlogBO.getBlogId());
        return ServerResponseEntity.success();
    }
}
